<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>三角形面积</title>
</head>

<body>
<script language="Javascript">
	function rec(form){
		
	var a=form.newC.value=form.th1.value/2+form.th2.value/2+form.th3.value/2
	    b=a-form.th1.value
		c=a-form.th2.value
		d=a-form.th3.value
	form.newvalue.value=Math.sqrt(a*b*c*d)
	}
	
	
	
	</script>
	
	

	<form action="">
	<h1>三角形的面积</h1>
	<blockquote>
	  
	    边1
	    <input type="text" name="th1"><br>
	    边2
	    <input type="text" name="th2"><br>
	    边3
	    <input type="text" name="th3"><br>	
	    
	    <input type="button" name="button" onClick="rec(this.form)" value="周长的一半" >
	    
	    <input type="text" name="newC"><br>	
	    
	    <input type="button" name="button" onClick="rec(this.form)" value="面积" >
        	
	    <input type="text" name="newvalue">
      
	  </blockquote>
	</form>
	
	
</body>
</html>
